<template>
  <div>
    <Pager :total="total" :current="current" @pagerChange="handlePagerChange"/>
  </div>
</template>

<script>

import Pager from "@/components/Pager";
export default {
  components: {
    Pager,
  },
  data() {
    return {
      current: 1,
      total: 200,
    }
  },
  methods: {
    handlePagerChange(newPage) {
      if(newPage < 1) {
        newPage = 1;
      }
      if(newPage > this.total) {
        newPage = this.total;
      }
      if(newPage === this.current) {
        return;
      }
      this.current = newPage;
    }
  }
}
</script>

<style lang="less">

</style>